myAjax = function (option) {
  let xhr = new XMLHttpRequest()
  xhr.open(option.method, option.url)
  xhr.setRequestHeader('Content-Type', 'application/json')
  xhr.send(option.data)
  xhr.responseType = 'json'
  xhr.onreadystatechange = function () {
    if (xhr.readyState === 4) {
      if (xhr.status === 200) {
        option.success(xhr.response)
      } else {
        option.error(xhr.status)
      }
    }
  }
}

function getQuery(key) {
  const queryStrArr =  location.search.slice(1).split('&')
  for (let i = 0; i < queryStrArr.length; i++) {
    const item = queryStrArr[i].split('=')
    if (item[0] === key) {
      return item[1]
    }
  }
}
